package Month07.day27.test;

public class Student implements Comparable<Student>{
    private String name;
    private  int yuwen;
    private  int yinyu;
    private  int shuxue;

    public Student() {
    }

    public Student(String name, int yuwen, int yinyu, int shuxue) {
        this.name = name;
        this.yuwen = yuwen;
        this.yinyu = yinyu;
        this.shuxue = shuxue;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getYuwen() {
        return yuwen;
    }

    public void setYuwen(int yuwen) {
        this.yuwen = yuwen;
    }

    public int getYinyu() {
        return yinyu;
    }

    public void setYinyu(int yinyu) {
        this.yinyu = yinyu;
    }

    public int getShuxue() {
        return shuxue;
    }

    public void setShuxue(int shuxue) {
        this.shuxue = shuxue;
    }
    public int getSum(){
        return shuxue+yinyu+yinyu;
    }
    @Override
    public int compareTo(Student o) {
        int result=this.yinyu-o.yinyu;
        int result1=result==0?this.name.compareTo(o.name):result;
        return result1;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", yuwen=" + yuwen +
                ", yinyu=" + yinyu +
                ", shuxue=" + shuxue +
                '}';
    }
}
